<html>
<head>
    <meta charset="utf-8">
</head>
<body>

<?php
$from = $_POST['fromYear'];
$to = $_POST['toYear'];

if ($from == '不限年份') {
    $from = '0';
}

if ($to == '不限年份') {
    $to = '9999';
}

$arr = explode('年', $from);
$from = $arr[0];

$arr = explode('年', $to);
$to = $arr[0];

if ($from > $to) {
    $temp = $to;
    $to = $from;
    $from = $temp;
}
// ------基本设定------
$config = parse_ini_file("config/db_config.ini");
$server = $config["server"];
$username = $config["username"];
$password = $config["password"];
$database = $config["database"];

$link = mysqli_connect($server, $username, $password, $database);

$sql = "SELECT * FROM typhoon_total WHERE flat=0 and date between '" . $from . "000000' and '" . $to . "999999';";
$result = mysqli_query($link, $sql);
$row = mysqli_fetch_row($result);


echo '<table border="1" cellspacing="0px" cellpadding="2px" align="center">';
echo '<tr><td>★★★★★★★★★★★★★★★★★★★★★★★<br/></td></tr>';
echo '<tr><td><h1>☆☆>>符合查询结果的台风有<br /></h1></tr></td>';
echo '<tr><td>★★★★★★★★★★★★★★★★★★★★★★★<br/></td></tr>';

while ($row != null) {

    echo '<tr><td><h1>&nbsp;&nbsp;&nbsp;>>序号 : ' . floor($row[0] / 10000) . "年第" . sprintf("%03d", ($row[0] % 10000)) . "号气旋" . '</h1></tr></td>';
    echo '<tr><td><h1>&nbsp;&nbsp;&nbsp;>>名称 : ' . $row[2] . '</h1></tr></td>';
    echo "<tr><td><h1>&nbsp;&nbsp;&nbsp;>>展示 :<a href = \"show.php?num=" . $row[0] . "&count=" . $row[4] . "&table=typhoon_detail\"target=\"_top\">" . "点击此处进入展示页面" . "</a></h1></tr></td>";
    echo '<tr><td>★★★★★★★★★★★★★★★★★★★★★★★<br/></tr></td>';

    $row = mysqli_fetch_row($result);
}
echo '<tr><td>★★★★★★★★★★★★★★★★★★★★★★★<br/></tr></td></table>';


?>


</body>
</html>
